package com.seven.springboot.enums;

import java.util.Map;

/**
 * 性别
 * 
 * @author QinQichang
 * 
 */
public enum Gender implements IndexedEnum {
	
	GENDER_MALE(1, "男"), 
	GENDER_FEMALE(2,"女"),
	GENDER_UNKNOWN(3, "未知"),
	;

	int index;
	String message;

	private static final Map<Integer, Gender> enumMap = IndexedEnumUtil
			.toIndexMap(Gender.values());
	private static final Map<String, Gender> messageMap = IndexedEnumUtil.toMessageMap(Gender.values());
	
	private Gender(int index, String message) {

		this.index = index;
		this.message = message;
	}

	@Override
	public int getIndex() {
		
		return index;
	}

	@Override
	public String getMessage() {
		return message;
	}
	
	public static Gender valueOf(int index) {
		return enumMap.get(index);
	}
	
	public static Gender messageOf(final String message) {
		return messageMap.get(message);
	}
	
}
